﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BGCOP.CAVTOP.BUSINESSLAYER;
using BGCOP.CAVTOP.COMMON;
using Microsoft.Win32;

namespace BGCOP.CAVTOP.WINFORMS
{
    public partial class frmHorarioDetail : Form
    {
        public int idH;
        public frmHorarioDetail()
        {
            InitializeComponent();
            this.Closing += new CancelEventHandler(frmHorarioDetail_Closing);
            this.Load += new EventHandler(frmHorarioDetail_Load);
        }

        void frmHorarioDetail_Load(object sender, EventArgs e)
        {

            if (Properties.Settings.Default.FLqW1 == "nn")
            {
                //es la primera vez
                Properties.Settings.Default.FLqW1 = DateTime.Now.ToString();
                Properties.Settings.Default.FLqW2 = DateTime.Now.ToString();

            }
            dateTimePicker1.Value = Convert.ToDateTime(Properties.Settings.Default.FLqW1);
            dateTimePicker2.Value = Convert.ToDateTime(Properties.Settings.Default.FLqW2);
        }

        void frmHorarioDetail_Closing(object sender, CancelEventArgs e)
        {
            Properties.Settings.Default.FLqW1 = dateTimePicker1.Value.ToString();
            Properties.Settings.Default.FLqW2 = dateTimePicker2.Value.ToString();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            DiasHorario dh = new DiasHorario();
            string h1 = dateTimePicker1.Value.ToShortTimeString();
            string h2 = dateTimePicker2.Value.ToShortTimeString();
            dh.Agregar(idH, comboBox1.SelectedIndex + 1, h1, h2, textBox1.Text);
            this.Close();
        }
    }
}
